const Sequelize = require('sequelize')
let db = require('../config/db')


let Cash_application = db.define('cash_application', {
    id: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment: "主键，自增"
    },
    uid: {
        type: Sequelize.INTEGER
    },
    amount:{
        type: Sequelize.STRING,
    },
    account: {
        type: Sequelize.STRING,
    },
    username: {
        type: Sequelize.STRING,
    },
    status_name: {
        type: Sequelize.STRING,
    },
    status: {
        type: Sequelize.INTEGER,
    },
    deletedAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('deletedAt')).format('YYYY-MM-DD HH:mm:ss');
        }
    },
    createdAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('createdAt')).format('YYYY-MM-DD HH:mm:ss');
        }
    },
    updatedAt: {
        type: Sequelize.DATE,
        get() {
            return moment(this.getDataValue('updatedAt')).format('YYYY-MM-DD HH:mm:ss');
        }
    },
    isDel: {
        type: Sequelize.INTEGER,
        defaultValue: 0,
        comment: '状态，是否删除'
    }
}, {
    freezeTableName: true,
    paranoid: true,
    timestamps: true
})
let cash_application = Cash_application.sync();

module.exports = Cash_application
